<?php

namespace app\admin\model\xmwms;

use think\Model;

class Brand extends Model
{
    // 表名
    protected $name = 'wms_brand';

    /**
     * @var string 自动写入时间戳字段
     */
    protected $autoWriteTimestamp = true;

    protected static function onAfterInsert($model)
    {
        if ($model->weigh == 0) {
            $pk = $model->getPk();
            $model->where($pk, $model[$pk])->update(['weigh' => $model[$pk]]);
        }
    }

    public function getImageAttr($value): string
    {
        return !$value ? '':$value;
    }

}